package com.CST.service.impl.zx;

import com.CST.entity.cb.BdEnumdetail;
import com.CST.mapper.dataplatform.BdEnumdetailMapper;
import com.CST.service.zx.IZxUFIDADepartmentService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author 伍文毅
 * @Date 2023 02 28 10 51
 **/
@Service("zxUFIDADepartmentService")
public class ZxUFIDADepartmentServiceImpl extends ServiceImpl<BdEnumdetailMapper, BdEnumdetail>
        implements IZxUFIDADepartmentService {
    @Override
    public List<BdEnumdetail> myPage(BdEnumdetail bdEnumdetail) {
        LambdaQueryWrapper<BdEnumdetail> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(bdEnumdetail.getEdName()!=null,BdEnumdetail::getEdName,bdEnumdetail.getEdName())
                .like(bdEnumdetail.getEdExtraFirstDescription()!=null,BdEnumdetail::getEdExtraFirstDescription,bdEnumdetail.getEdExtraFirstDescription())
                .like(bdEnumdetail.getEdExtraSecondDescription()!=null,BdEnumdetail::getEdExtraSecondDescription,bdEnumdetail.getEdExtraSecondDescription())
                .eq(bdEnumdetail.getRowStatus()!=null,BdEnumdetail::getRowStatus,bdEnumdetail.getRowStatus())
                .select(BdEnumdetail::getEdId,BdEnumdetail::getEdExtraFirstCode,BdEnumdetail::getEdExtraFirstDescription,BdEnumdetail::getEdExtraSecondCode,
                        BdEnumdetail::getEdExtraSecondDescription,BdEnumdetail::getRowStatus,BdEnumdetail::getCreatedOn);
        List<BdEnumdetail> list = this.list(lambdaQueryWrapper);
        return list;
    }

    @Override
    public List<BdEnumdetail> selectEdName(BdEnumdetail bdEnumdetail) {
        LambdaQueryWrapper<BdEnumdetail> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(bdEnumdetail.getEdName()!=null,BdEnumdetail::getEdName,bdEnumdetail.getEdName())
                .eq(bdEnumdetail.getRowStatus()!=null,BdEnumdetail::getRowStatus,0)
                .select(BdEnumdetail::getEdId,BdEnumdetail::getEdExtraSecondCode,
                        BdEnumdetail::getEdExtraSecondDescription);
        List<BdEnumdetail> list = this.list(lambdaQueryWrapper);
        return list;
    }
}
